<!DOCTYPE html>
<html lang="zh">

<head>
	<meta charset="UTF-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<meta http-equiv="Access-Control-Allow-Origin" content="*">
	<title>宇成建筑-登录</title>
	<link rel="stylesheet" href="../statics/plugins/layui/css/layui.css" />
	<link rel="stylesheet" href="../statics/css/font.css">
	<link rel="stylesheet" href="../statics/css/login.css">
</head>

<body>
	<header>
		<div class="layui-row">
			<div class="layui-col-xs2 logo">
				<img src="../statics/images/logo.png" alt="" />
				<span></span>
			</div>
			<div class="layui-col-xs10 title">
				<span>君正方华建筑施工劳务企业管理系统</span>
			</div>
		</div>
	</header>
	<main>
		<div class="main">
			<div class="layui-row title">
				<div class="layui-col-xs12">
					<h2>君正方华建筑施工劳务企业管理系统</h2>
				</div>
			</div>
			<div class="input-box">
				<div class='input-width'>
					<i class='iconfont'>&#xe614;</i>
					<input type="text" placeholder="用户名" id='username' autocomplete="off">
				</div>
				<div class='input-width'>
					<i class='iconfont password'>&#xe61a;</i>
					<input type="password" placeholder="密码" id='password'>
				</div>
			</div>
<!--			<div class="input-box forgetPwd">-->
<!--				<div class='input-width'>-->
<!--					<a href="forgetPwd-phone.html">忘记密码？</a>-->
<!--				</div>-->
<!--			</div>-->
			<div class="input-box login">
				<div class='input-width'>
					<button class="layui-btn layui-btn-normal">登录</button>
				</div>
			</div>
		</div>
	</main>
	<footer>
		<p>天津市君正方华科技有限公司 版权信息：xxxxxxxxxxxxx 备案号：<a href="http://www.beian.miit.gov.cn">津ICP备18000734号</a></p>
	</footer>
	<script src='../statics/plugins/layui/layui.js'></script>
	<script src='../statics/plugins/jQuery-3.2.1/jquery-3.2.1.min.js'></script>
	<script src="../statics/js/public.js?v=1129"></script>
	<script>
		$(function () {
			localStorage.clear();
		})
		layui.use(['layer'], function () {
			var layer = layui.layer;
			$('body').on('click', '.login button', function () {
				var username = $('#username').val();
				var password = $('#password').val();
				if (username == "") {
					layer.msg('用户名不能为空！');
				} else if (password == "") {
					layer.msg('密码不能为空！');
				}else{
					$.ajax({
						url: url + "/auth/project/login",
						type: "POST",
						data: {
							username: username,
							password: password
						},
						success: function(r) {
							if(r.code==100000){
								localStorage.setItem('login_msg',JSON.stringify(r.data));//用户信息
								localStorage.setItem('menu',JSON.stringify(r.data.menu));//菜单栏
								var permission=[];
								for(var p=0;p<r.data.permission.length;p++){
									permission.push(r.data.permission[p].code);
								}
								localStorage.setItem('permission',JSON.stringify(permission));//权限列表
								layer.msg('登陆成功!');
								setTimeout(function(){
									window.location.href='indexPage.html';
								},2000)
							}else{
								tips('登录',r);
							}
						}
					})
				}
			})
		})
	</script>
</body>

</html>